<?php defined('SYSPATH') or die('No direct script access.');
 
class Model_Menu extends ORM {
	protected $_table_name = 'menu';

	public function getAll($postfix) {
		return DB::select('id', 'page_id', array('title'.$postfix, 'title'), 'link', 'with_childrens')
			->from($this->_table_name)
			->where('parent_id', '=', '0')
			->as_object()
			->execute();
	}

	public function get_submenu($id) {
		return DB::select('id', 'page_id', 'title', 'link', 'with_childrens')
			->from($this->_table_name)
			->where('parent_id', '=', $id)
			->as_object()
			->execute();
	}
}